package com.example.bgImageSear.user.service.impl;

import com.example.bgImageSear.user.entity.UserEntity;
import com.example.bgImageSear.user.mapper.UserMapper;
import com.example.bgImageSear.user.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public UserEntity getUserByPassword(UserEntity userEntity) {
        return userMapper.getUserByPassword(userEntity);
    }

    @Override
    public List<UserEntity> getUserList() {
        return userMapper.getUserList();
    }

    @Override
    public long save(UserEntity userEntity){
        return userMapper.save(userEntity);
    }

    @Override
    public long del(Long[] ids){
        return userMapper.del(ids);
    }

    @Override
    public long update(UserEntity userEntity){
        return userMapper.update(userEntity);
    }

    @Override
    public UserEntity userLogin(String username, String password) {
        UserEntity userEntity = new UserEntity();
        userEntity.setUsername(username);
        userEntity.setPassword(password);
        return userMapper.getUserByPassword(userEntity);
    }
}
